class PatientInsurancesController < ApplicationController
  before_action :set_patient_insurance, only: [:show, :edit, :update, :destroy]

  def index
    @patient_insurances = PatientInsurance.all
    respond_with(@patient_insurances)
  end

  def show
    respond_with(@patient_insurance)
  end

  def new
    @patient_insurance = PatientInsurance.new
    respond_with(@patient_insurance)
  end

  def edit
  end

  def create
    @patient_insurance = PatientInsurance.new(patient_insurance_params)
    @patient_insurance.save
    respond_with(@patient_insurance)
  end

  def update
    @patient_insurance.update(patient_insurance_params)
    respond_with(@patient_insurance)
  end

  def destroy
    @patient_insurance.destroy
    respond_with(@patient_insurance)
  end

  private
    def set_patient_insurance
      @patient_insurance = PatientInsurance.find(params[:id])
    end

    def patient_insurance_params
      params.require(:patient_insurance).permit(:insurance_number, :patient_id, :insurance_company_id, :created_by, :updated_by)
    end
end
